package com.lsh.oms.core.dao.other;

import com.lsh.oms.core.dao.MyBatisRepository;
import com.lsh.oms.core.records.core.Return;
import com.lsh.oms.core.records.core.ReturnResult;
import com.lsh.oms.core.service.tool.Criteria;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;

@MyBatisRepository
public interface ReturnResultMapper {

    void insert(@Param("return") Return re, @Param("request") Map<String, Object> request);

    void insertDetails(@Param("request") List<Map<String, Object>> request);

    ReturnResult findById(@Param("id") Long id);

    List<ReturnResult.ReturnResultDetail> findDetails(@Param("return_result_ids") Collection<Long> returnIds);

    List<ReturnResult> findBaseOnCriteria(@Param("criteria") Criteria criteria, @Param("start") long start, @Param("limit") long limit);

    List<ReturnResult> findByReturnId(@Param("return_id") Long returnId);

    Long countBaseOnCriteria(@Param("criteria") Criteria criteria);

    List<Map<String, Object>> groupByStatus(@Param("criteria") Criteria criteria);

    int updatePayment(@Param("return_result") ReturnResult returnResult);

    int updateSoInfo(@Param("return_result") ReturnResult returnResult);

    int updateStatusByReturnId(@Param("return_id") Long returnId, @Param("base_status") ReturnResult.Status baseStatus, @Param("status") ReturnResult.Status status);

    int updateActualAmount(@Param("return_result") ReturnResult returnResult);

    int updateDetailActualAmount(@Param("detail") ReturnResult.ReturnResultDetail detail);
}